package com.netease.pris.activity;

import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.ContentResolver;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.provider.MediaStore.Images.Media;
import android.text.Editable;
import android.text.InputFilter;
import android.text.InputFilter.LengthFilter;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import com.netease.framework.ActivityEx;
import com.netease.image.d;
import com.netease.image.video.ActivityCropImage;
import com.netease.l.a.a;
import com.netease.pris.a.p;
import com.netease.pris.atom.userinfo.UserInfo;
import com.netease.pris.b;
import com.netease.pris.v;

public class PRISActivityUserInfoModify extends ActivityEx
  implements TextWatcher, View.OnClickListener, AdapterView.OnItemSelectedListener
{
  static final int c = 0;
  static final int d = 1;
  private static final String g = PRISActivityUserInfoModify.class.getCanonicalName();
  private static final int u = 0;
  private static final int v = 1;
  boolean a = false;
  DialogInterface.OnClickListener b = new ei(this);
  Handler e = new ej(this);
  boolean f = false;
  private UserInfo h = null;
  private String[] i;
  private ImageView j;
  private TextView k;
  private TextView l;
  private TextView m;
  private EditText n;
  private Spinner o;
  private EditText p;
  private EditText[] q = new EditText[5];
  private TextView r;
  private TextView s;
  private Bitmap t;
  private b w = new eh(this);

  public static void a(Activity paramActivity, int paramInt, UserInfo paramUserInfo, Bitmap paramBitmap)
  {
    Intent localIntent = new Intent(paramActivity, PRISActivityUserInfoModify.class);
    Bundle localBundle = new Bundle();
    localBundle.putParcelable("extra_userinfo_value", paramUserInfo);
    localBundle.putParcelable("data", paramBitmap);
    localIntent.putExtras(localBundle);
    paramActivity.startActivityForResult(localIntent, 1);
  }

  private void b()
  {
    setTitle(2131362086);
    findViewById(2131558408).setOnClickListener(this);
    this.j = ((ImageView)findViewById(2131558689));
    if (this.t == null)
    {
      StringBuilder localStringBuilder = new StringBuilder();
      d.a().a(localStringBuilder, 1, this.h.w(), new ee(this, localStringBuilder), 48, 48, 1);
    }
    InputFilter[] arrayOfInputFilter1;
    while (true)
    {
      this.k = ((TextView)findViewById(2131558690));
      this.l = ((TextView)findViewById(2131558691));
      this.l.setText(a.b(this, this.h.g()));
      this.m = ((TextView)findViewById(2131558692));
      this.m.setOnClickListener(this);
      this.n = ((EditText)findViewById(2131558693));
      if (this.h.a())
      {
        this.k.setText(this.h.x());
        InputFilter[] arrayOfInputFilter3 = new InputFilter[1];
        arrayOfInputFilter3[0] = new InputFilter.LengthFilter(this.h.h());
        this.n.setFilters(arrayOfInputFilter3);
        this.n.setText(this.h.x());
        this.n.setSelection(0);
      }
      this.n.addTextChangedListener(this);
      this.o = ((Spinner)findViewById(2131558694));
      ArrayAdapter localArrayAdapter = new ArrayAdapter(this, 17367048, this.i);
      localArrayAdapter.setDropDownViewResource(17367049);
      this.o.setAdapter(localArrayAdapter);
      this.o.setVisibility(0);
      this.o.setPrompt(getString(2131362087));
      this.o.setSelection(c(a.b(this, this.h.g())), false);
      this.p = ((EditText)findViewById(2131558695));
      if (this.h.b())
      {
        InputFilter[] arrayOfInputFilter2 = new InputFilter[1];
        arrayOfInputFilter2[0] = new InputFilter.LengthFilter(this.h.s());
        this.p.setFilters(arrayOfInputFilter2);
        this.p.addTextChangedListener(this);
      }
      this.p.setText(this.h.f());
      this.q[0] = ((EditText)findViewById(2131558696));
      this.q[1] = ((EditText)findViewById(2131558697));
      this.q[2] = ((EditText)findViewById(2131558698));
      this.q[3] = ((EditText)findViewById(2131558699));
      this.q[4] = ((EditText)findViewById(2131558700));
      arrayOfInputFilter1 = new InputFilter[1];
      arrayOfInputFilter1[0] = new InputFilter.LengthFilter(this.h.t());
      String[] arrayOfString = this.h.v();
      if (arrayOfString == null)
        break;
      for (int i2 = 0; i2 < arrayOfString.length; i2++)
        this.q[i2].setText(arrayOfString[i2]);
      this.j.setImageBitmap(this.t);
    }
    for (int i1 = 0; i1 < this.q.length; i1++)
    {
      this.q[i1].setFilters(arrayOfInputFilter1);
      this.q[i1].addTextChangedListener(this);
    }
    this.r = ((TextView)findViewById(2131558702));
    this.r.setOnClickListener(this);
    this.s = ((TextView)findViewById(2131558703));
    this.s.setOnClickListener(this);
    this.a = false;
  }

  private int c(String paramString)
  {
    int i1 = 0;
    if (TextUtils.isEmpty(paramString));
    label50: 
    while (true)
    {
      return i1;
      int i2 = this.i.length;
      for (int i3 = 0; ; i3++)
      {
        if (i3 >= i2)
          break label50;
        if (!this.i[i3].equals(paramString))
          continue;
        i1 = i3;
        break;
      }
    }
  }

  private void c()
  {
    this.j = null;
    this.k = null;
    this.l = null;
    this.m = null;
    this.n = null;
    this.o = null;
    this.p = null;
    this.q[0] = null;
    this.q[1] = null;
    this.q[2] = null;
    this.q[3] = null;
    this.q[4] = null;
    this.r = null;
    this.s = null;
    if (this.t != null)
    {
      this.t.recycle();
      this.t = null;
    }
  }

  private void e()
  {
    s();
  }

  private void f()
  {
    startActivityForResult(new Intent("android.intent.action.PICK", MediaStore.Images.Media.INTERNAL_CONTENT_URI), 3);
  }

  private void g()
  {
    this.h.h(this.n.getEditableText().toString());
    this.h.i(this.p.getEditableText().toString());
    this.h.y();
    for (int i1 = 0; i1 < this.q.length; i1++)
      this.h.k(this.q[i1].getEditableText().toString());
    showDialog(0);
    v localv = v.a();
    UserInfo localUserInfo = this.h;
    if (this.f);
    for (Bitmap localBitmap = this.t; ; localBitmap = null)
    {
      localv.a(localUserInfo, localBitmap, null);
      return;
    }
  }

  private void h()
  {
    if (this.a)
      showDialog(1);
    while (true)
    {
      return;
      finish();
    }
  }

  private void r()
  {
    new AlertDialog.Builder(this).setTitle(2131362088).setItems(getResources().getStringArray(2131165199), new eg(this)).show();
  }

  private void s()
  {
    startActivityForResult(new Intent("android.media.action.IMAGE_CAPTURE"), 2);
  }

  void a(int paramInt, Intent paramIntent)
  {
    switch (paramInt)
    {
    case 0:
    default:
    case -1:
    }
    while (true)
    {
      return;
      Bitmap localBitmap = (Bitmap)paramIntent.getExtras().get("data");
      Intent localIntent = new Intent(this, ActivityCropImage.class);
      Bundle localBundle = new Bundle();
      localBundle.putParcelable("data", localBitmap);
      localIntent.putExtras(localBundle);
      startActivityForResult(localIntent, 4);
      localBitmap.recycle();
    }
  }

  void a(String paramString)
  {
    ActivityCropImage.b(this, 4, BitmapFactory.decodeFile(paramString));
  }

  public void afterTextChanged(Editable paramEditable)
  {
    this.a = true;
  }

  void b(int paramInt, Intent paramIntent)
  {
    switch (paramInt)
    {
    case 0:
    default:
    case -1:
    }
    while (true)
    {
      return;
      Uri localUri = paramIntent.getData();
      String[] arrayOfString = new String[1];
      arrayOfString[0] = "_data";
      Cursor localCursor = getContentResolver().query(localUri, arrayOfString, null, null, null);
      if (localCursor != null);
      try
      {
        if (localCursor.moveToFirst())
          ActivityCropImage.b(this, 4, p.a(BitmapFactory.decodeFile(localCursor.getString(0)), 256, 256));
        if (localCursor == null)
          continue;
        localCursor.close();
      }
      finally
      {
        if (localCursor != null)
          localCursor.close();
      }
    }
  }

  public void beforeTextChanged(CharSequence paramCharSequence, int paramInt1, int paramInt2, int paramInt3)
  {
  }

  void c(int paramInt, Intent paramIntent)
  {
    switch (paramInt)
    {
    case 0:
    default:
    case -1:
    }
    while (true)
    {
      return;
      Bitmap localBitmap = (Bitmap)paramIntent.getExtras().getParcelable("data");
      this.t = localBitmap;
      this.j.setImageBitmap(p.a(localBitmap));
      this.f = true;
    }
  }

  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    if (paramInt2 == -1)
      this.a = true;
    switch (paramInt1)
    {
    default:
    case 2:
    case 3:
    case 4:
    }
    while (true)
    {
      return;
      a(paramInt2, paramIntent);
      continue;
      b(paramInt2, paramIntent);
      continue;
      c(paramInt2, paramIntent);
    }
  }

  public void onClick(View paramView)
  {
    switch (paramView.getId())
    {
    default:
    case 2131558408:
    case 2131558702:
    case 2131558703:
    case 2131558692:
    }
    while (true)
    {
      return;
      g();
      continue;
      h();
      continue;
      r();
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903119);
    v.a().a(this.w);
    Bundle localBundle = getIntent().getExtras();
    this.h = ((UserInfo)localBundle.getParcelable("extra_userinfo_value"));
    this.t = ((Bitmap)localBundle.getParcelable("data"));
    if (this.h == null)
      finish();
    while (true)
    {
      return;
      this.i = getResources().getStringArray(2131165202);
      b();
    }
  }

  protected Dialog onCreateDialog(int paramInt)
  {
    Object localObject;
    switch (paramInt)
    {
    default:
      localObject = super.onCreateDialog(paramInt);
    case 0:
    case 1:
    }
    while (true)
    {
      return localObject;
      localObject = new ProgressDialog(this);
      ((ProgressDialog)localObject).setMessage(getString(2131362096));
      ((ProgressDialog)localObject).setOnDismissListener(new ef(this));
      continue;
      localObject = new AlertDialog.Builder(this).setIcon(2130837643).setTitle(2131362097).setMessage(2131362098).setPositiveButton(2131362099, this.b).setNeutralButton(2131362101, this.b).setNegativeButton(2131362100, this.b).create();
    }
  }

  protected void onDestroy()
  {
    c();
    v.a().b(this.w);
    super.onDestroy();
  }

  public void onItemSelected(AdapterView paramAdapterView, View paramView, int paramInt, long paramLong)
  {
    this.a = true;
    this.h.j(a.a(this, this.i[paramInt]));
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    int i1 = 1;
    if ((paramInt == 4) && (paramKeyEvent.getAction() == 0) && (this.a))
      showDialog(i1);
    while (true)
    {
      return i1;
      boolean bool = super.onKeyDown(paramInt, paramKeyEvent);
    }
  }

  public void onNothingSelected(AdapterView paramAdapterView)
  {
  }

  protected void onPause()
  {
    super.onPause();
    this.o.setOnItemSelectedListener(null);
  }

  protected void onResume()
  {
    super.onResume();
    this.o.setOnItemSelectedListener(this);
  }

  public void onTextChanged(CharSequence paramCharSequence, int paramInt1, int paramInt2, int paramInt3)
  {
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.PRISActivityUserInfoModify
 * JD-Core Version:    0.6.0
 */